﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using model;
using System.Data.SqlClient;

namespace dal
{
  public class userdal
    {
        public static model.userinfo ExecuteReader(string accout, string pass)
        {
            string sqlstr = "select * from User where accout=@accout and pass=@pass ";
            SqlParameter[] paras = new SqlParameter[] {
            new SqlParameter("@accout",accout),
            new SqlParameter("@pass",pass)

            };
            SqlDataReader reader = DBHelper.ExecuteReader(sqlstr, paras);
            List<userinfo> lst = new List<userinfo>();
            while (reader.Read())
            {
                userinfo ue = new model.userinfo();
                ue.name = reader["name"].ToString();
                ue.possword = reader["possword"].ToString();
                lst.Add(ue);
            }



            if (lst.Count > 0)

                return lst[0];
            else
                return null;

        }
    }
}
